# Contributor: Fabio Ribeiro <fabiorphp@gmail.com>
# Maintainer: Fabio Ribeiro <fabiorphp@gmail.com>
pkgname=rabbitmq-c
pkgver=0.13.0
pkgrel=2
pkgdesc="RabbitMQ C client"
url="https://github.com/alanxz/rabbitmq-c"
arch="all"
license="MIT"
depends_dev="popt-dev"
makedepends="$depends_dev openssl-dev>3 cmake xmlto doxygen samurai"
subpackages="$pkgname-utils $pkgname-doc::noarch $pkgname-static $pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/alanxz/rabbitmq-c/archive/v$pkgver.tar.gz"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_STATIC_LIBS=ON \
		-DBUILD_SHARED_LIBS=ON \
		-DENABLE_SSL_SUPPORT=ON \
		-DBUILD_TOOLS=ON \
		-DBUILD_TOOLS_DOCS=ON
	cmake --build build
}

check() {
	cd build
	ctest -E basic
}

package() {
	DESTDIR="$pkgdir" cmake --build build --target install
}

utils() {
	pkgdesc="$pkgdesc (command line utilities)"

	amove usr/bin
}

sha512sums="
a93c104846b7d004c97019f81879db4daf747fd29ee6f4feaf287302c0f24d5d34d8c7bc232805ccabf105fd1aa6dfcb88218236bb6bb33cebf64ec9e3dcd77c  rabbitmq-c-0.13.0.tar.gz
"
